<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">

<?php
	if (!isset($_SESSION)) {session_start();}
	require("php/akses.php");
	require("php/validation.php");
	$justReg = isJustReg();
	$errors = array("","","","","","","","");
	$lastinput = array("","","","","","","","","");
	$valid = true;
	if (isLogin()) {
		header('Location: profil.php');
	}
	if ($justReg) {
		allValidation($errors, $valid,$lastinput);
	}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<script type="text/javascript" src="javascript/foodholic.js"></script>
	<link rel="stylesheet" type="text/css" href="css/htmlDatePicker.css" />
	<script type="text/javascript" src="javascript/htmlDatePicker.js"></script>
	<title>Registrasi</title>
</head>

<body>
		<?php require "header.php"; ?>
		<div id="content">
			<div id="lblsignup">
				SIGN UP
			</div>
			<div id="formreg">
				<div id="blank">
				</div>
				<div id="fields">
					<div class="input_label">Avatar:</div>
					<div class="input_label">Username :</div>
					<div class="input_label">Password :</div>
					<div class="input_label">Confirm Password :</div>
					<div class="input_label">Full Name :</div>
					<div class="input_label">Birthday :</div>
					<div class="input_label">Email :</div>
					<div class="input_label">Gender :</div>
					<div id="input_label_about">About Me :</div>
				</div>
				
				<div id="validations">
					<div class="validation">
						<?php echo $errors[6]; ?>
					</div>
					<div class="validation" id="validusername">
						<?php echo $errors[0]; ?>
					</div>
					<div class="validation" id="validpassword">
						<?php echo $errors[1]; ?>
					</div>
					<div class="validation" id="validconfirm">
						<?php echo $errors[2]; ?>
					</div>
					<div class="validation" id="validfullname">
						<?php echo $errors[3]; ?>
					</div>
					<div class="validation" id="validdate">
						<?php echo $errors[7]; ?>
					</div>
					<div class="validation" id="validemail">
						<?php echo $errors[4]; ?>
					</div>
					<div class="validation" id="validgender">
						<?php echo $errors[5]; ?>
					</div>
				</div>
				
				<!-- <form name="registration" action="" onsubmit="allValidation()"> -->
				<form name="registration" enctype="multipart/form-data" action="registrasi.php" method="post">
					<div id="inputs">
						<div>
							<input type="file" name="myImage" size="30" value="<?php echo $lastinput[0]; ?>" />
						</div>
						<div class="input_box">
							<input type="text" name="text_username" id="text_username" size="51" value="<?php echo $lastinput[1]; ?>" onKeyUp="UsernameChange();" onChange="UsernameChange();" />
						</div>
						<div class="input_box">
							<input type="password" name="text_password" id="text_password"  size="51" value="<?php echo $lastinput[2]; ?>" onKeyUp="PasswordChange();" onChange="PasswordChange();" />
						</div>
						<div class="input_box">
							<input type="password" name="text_confirm"  size="51" value="<?php echo $lastinput[3]; ?>"/>
							</div>
						<div class="input_box">
							<input type="text" name="text_fullname"  size="51" value="<?php echo $lastinput[4]; ?>" />
						</div>
						<div class="input_box">
							<script language="javascript">
								DisablePast = false;
								range_start = new Date(2012,3-8,8);
								range_end = new Date(2099,12-12,5);
							</script>
							<input type="text" name="SelectedDate" id="SelectedDate" size="51"  value="<?php echo $lastinput[5]; ?>" onClick="GetDate(this);" />
						</div>
						<div class="input_box"><input type="text" name="text_email" id="text_email"  size="51" value="<?php echo $lastinput[6]; ?>" /></div>
						<div class="input_box">
							<select name="select_gender">
								<?php 
									if ($lastinput[7]=="Male") {
										echo "<option>Choose one</option>";
										echo "<option selected=\"selected\">Male</option>";
										echo "<option>Female</option>";
									} else {
										if ($lastinput[7]=="Female") {
											echo "<option>Choose one</option>";
											echo "<option>Male</option>";
											echo "<option selected=\"selected\">Female</option>";
										} else {
											echo "<option selected=\"selected\">Choose one</option>";
											echo "<option>Male</option>";
											echo "<option>Female</option>";
										}
									}
								?>
							</select>
						</div>
						<div id="input_about">
							<textarea name="text_aboutme" cols="40" rows="10"><?php echo $lastinput[8]; ?></textarea>
						</div>
					</div>
					<?php 
						$justReg = true;
					?>
					<input type="submit" name="submit" value="Register" />
				</form>
			</div>
		</div>
		
		<?php require "footer.php"; ?>
	</div>
</body>
</html>